#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTableWidget>
#include <QTimer>
#include <vector>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
private slots:
    void on_generateButton_clicked();
    void on_runFIFOButton_clicked();
    void on_runOPTButton_clicked();
    void on_runLRUButton_clicked();
private:
    Ui::MainWindow *ui;
    QTableWidget * table;
    QTimer *timer;
    std::vector<int> pageSequence;
    std::vector<int> frames;
    std::vector<int> result;
    int currentStep;
    void generatePageSequence();
    void runFIFO();
    void runOPT();
    void runLRU();
    void displayResults(const QString &algorithm, const std::vector<std::vector<int>> &frames,const std::vector<int> & evictedpages,int pagefaluts);
    void setColor(QTableWidgetItem *item, int page);
};
#endif // MAINWINDOW_H
